package cn.pzhu.services.web;

import cn.pzhu.model.Logistics;
import cn.pzhu.services.BaseServices;

import java.util.List;

/**
 * Created by dongp on 2016/5/10.
 */
public class WebLogistics extends BaseServices {

	public List<Logistics> queryByUserId(int userId) {
		List<Logistics> logistics = Logistics.dao.find("select * from logistics where userID = ?",userId);
		return logistics;
	}

	public int addLogistic(int userId, String recipient, String phone, String address, String transport, String postCode) {
		Logistics logistics = new Logistics();
		boolean result = logistics.set("userID", userId).set("recipient",recipient).set("phone",phone).
				set("address",address).set("transport",transport).set("postCode",postCode).save();
		int logicId = logistics.getInt("logisticsID");
		return logicId;
	}
}
